import gcRequest from '..'
import { addCollectionRes, checkCollectonRes, collectionRes } from './types'

export const getCollections = (offect: number, limit: number) => {
  return gcRequest.get<collectionRes.RootObject>({
    url: '/collection/user',
    params: {
      offect,
      limit
    }
  })
}

export const removeCollection = (id: number) => {
  return gcRequest.delete({
    url: `/collection/${id}`
  })
}

export const addCollection = (productId: number) => {
  return gcRequest.post<addCollectionRes.RootObject>({
    url: '/collection',
    data: {
      productId
    }
  })
}

export const removeCollectionByProductId = (productId: number) => {
  return gcRequest.delete({
    url: '/collection',
    data: {
      productId
    }
  })
}

export const checkIsCollection = (productId: number) => {
  return gcRequest.post<checkCollectonRes.RootObject>({
    url: '/collection/check',
    data: {
      productId
    }
  })
}
